home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 August / Macworld (1999-08).dmg / Updaters / GV PC Card 56K 2.200 ROM / GV flex⁄V.90 ARA 2.1⁄3.0⁄OT-PPP / GV flex_V.90 ARA 2.1_3.0_OT-PPP next >
Text File  |  1998-08-19  |  14KB  |  709 lines

  1. !  Copyright: © 1991-1997 Global Village Communication, Inc.     All Rights Reserved.
  2. !    Portions Authored by: Kris Kreutzman
  3. !    Portions Copyright:    © 1991-1996 Apple Computer, Inc.    All Rights Reserved.
  4. !
  5. !    revision history:
  6. !   1.1.0 03/25/98 CRK      Added support for v.90 speeds
  7. !   1.0.8 03/25/98 GAS/CRK  Modified hangup code and added support for v.90 speeds
  8. !    1.0.7 06/24/97 GAS        Modified init and hang up code to fix ARAP callbacks
  9. !    1.0.6 06/13/97 GAS        Modified hangup code
  10. !   1.0.5 03/12/97 GAS        Updated code to support K56Flex speeds
  11. !    1.0.4 01/31/97 RHY        Removed the \^ from diaing strings to turn off data
  12. !                            calling tones.
  13. !     1.0.3 11/15/96 DEJ         Added fix for problem when "Ring through modem" is on and 
  14. !                            making ARA connection.
  15. !   1.0.1 09/05/96 DEJ      Generated basic Apple/Kris Kreutzman script w/MSG 1.0a1.
  16. !                            Integrated earlier/cleaner answer & hangup (rhoiberg),
  17. !                           Platinum mods (SAP), Fax/ARA discrimination (crw), Int'l 
  18. !                           Blacklisting & blind dialing (DEJ), 31.2k & 33.6k (gas).
  19. !  'mlts' resource info for this modem:
  20. !    byte 1 == 01 -> modem HAS built-in error correction protocols
  21. !    byte 2 == 01 -> modem HAS built-in data compression protocols
  22. !    byte 3 == 40 -> max number of chars (hex 28) in varstr 7
  23. !    byte 4 == 40 -> max number of chars (hex 28) in varstr 8
  24. !    byte 5 == 40 -> max number of chars (hex 28) in varstr 9
  25. !    
  26. @ORIGINATE
  27. @ANSWER
  28. ! ---- Initial modem setup ----
  29. ! In originate mode, set serial port speed depending upon the compression flag
  30. !    A higher rate with compression on (PPP) to handle expanded data from the modem
  31. !    A lower rate closer to the DCE when compression is off (ARA)
  32. ifstr 5 1 "0"
  33. serreset 115200, 0, 8, 1
  34. jump 2
  35. !
  36. @LABEL 1
  37. serreset 57600, 0, 8, 1
  38. !
  39. @LABEL 2
  40. hsreset 0 0 0 0 0 0
  41. settries 0
  42. !
  43. ! Get the modem's attention
  44. !
  45. matchclr
  46. matchstr 1 3 "OK\13\10"
  47. write "AT\13"
  48. matchread 60
  49. pause 90
  50. !
  51. @LABEL 3
  52. matchclr
  53. matchstr 1 4   "OK\13\10"
  54. matchstr 2 101 "ERROR\13\10"
  55. write "AT&F1E0W2S95=45S0=0&D3S7=60\13"
  56. matchread 90
  57. inctries
  58. iftries 3 101
  59. !
  60. ! Reset the Modem on setup failure
  61. !
  62. DTRClear
  63. pause 5
  64. DTRSet
  65. flush
  66. pause 90
  67. jump 3
  68. !
  69. !
  70. @LABEL 4
  71. ! Modem now responding and configured for full EC/DC functions.
  72. ! Varstring 4 , reliable link protocol:
  73. !    = 0, handled by computer (ARAP)
  74. !    = 1, handled by modem (PPP)
  75. !    = 2, MNP10 protocol (Cellular protocol, no longer supported)
  76. ! If PPP or Cellular mode, jump to 5, otherwise (ARA) disable EC/DC.
  77. ifstr 4 5 "1"
  78. ifstr 4 5 "2"
  79. !
  80. ! Varstring 4 == 0, turn off reliable link protocol in modem (ARAP)
  81. matchclr
  82. matchstr 1 9 "OK\13\10"
  83. write "AT\\N0\13"
  84. matchread 30
  85. jump 101
  86. !
  87. !
  88. @LABEL 5
  89. ! This is where MNP10 (or MNP10EC) could go, if/when we support that.
  90. ! Standard EC/DC is still on.  Decide whether to turn off DC.
  91. ! Varstring 5, compression protocol:
  92. !    = 0, handled by computer 
  93. !    = 1, handled by modem
  94. ifstr 5 9 "1"
  95. !
  96. ! Varstring 5 == 0, turn off compression protocol in modem.
  97. matchclr
  98. matchstr 1 9 "OK\13\10"
  99. write "AT%C0\13"
  100. matchread 30
  101. jump 101
  102. !
  103. !
  104. @LABEL 9
  105. ! If speaker on flag is true, jump to 13.  Otherwise, turn the speaker off.
  106. ! Varstring 2, modem speaker:
  107. !    = 0, speaker off
  108. !    = 1, speaker on
  109. ifstr 2 13 "1"
  110. pause 5
  111. matchclr
  112. matchstr 1 13 "OK\13\10"
  113. write "ATM0\13"
  114. matchread 30
  115. jump 101
  116. !
  117. ! Modem ready, wait for a call or originate a call
  118. !
  119. @LABEL 13
  120. ifANSWER 32
  121. !
  122. !
  123. ! ---- Originating a call ----
  124. ! For normal dialing, jump to 19.  Otherwise, manual dial jumps to 15, blind dial
  125. !    jumps to 17.
  126. ! Varstring 6, dialing mode:
  127. !    = 0, normal dialing
  128. !    = 1, blind dialing
  129. !    = 2, manual dialing
  130. ifstr 6 17 "1"
  131. ifstr 6 15 "2"
  132. jump 19
  133. !
  134. @LABEL 15
  135. ! Display ASK dialog with message.  Goto label 107 if dialog canceled.
  136. ASK 2 "Pick up the phone & dial ^1.  Hit OK when the phone rings, then hangup." 107
  137. note "Manual dialing initiated" 3
  138. ! X1S6=4 to ignore dialtone 4 seconds, & ignore busy, D to dial, \^ generates data tone
  139. write "ATX1S6=4D\13"
  140. jump 32
  141. !
  142. @LABEL 17
  143. note "Dialing without tone" 3
  144. matchclr
  145. matchstr 1 19 "OK\13\10"
  146. ! X1S6=4 to ignore dialtone 4 seconds, & ignore busy for blind dialing.
  147. write "ATX1S6=4\13"
  148. matchread 30
  149. jump 101
  150. !
  151. !
  152. @LABEL 19
  153. ! This is where we break up long dialstrings
  154. ! Display the full dialstring contained in Varstring 1
  155. note "Dialing ^1" 3
  156. !
  157. ! Varstrings 7, 8 and 9, contain dialstring fragments
  158. !    Long phone numbers may have been split into smaller groups
  159. !    so that the modem can use them
  160. ! Check to see whether these fragments exist.  If they do, dial them one at a time.
  161. ! If not, jump ahead and dial the remaining phone number.  Use the data tone.
  162. ! Varstring 3:  "p" for pulse & "t" for tone dialing
  163. ! Varstring 8 == blank (dialstring in varstring 7)
  164. ! Varstring 9 == blank (dialstring in varstrings 7 & 8)
  165. ! Otherwise (dialstring in varstrings 7, 8 & 9)
  166. ! \^ is added to the dialstring to force the modem to generate a data tone
  167. ifstr 8 27 " "
  168. ifstr 9 24 " "
  169. !
  170. !  Write dialstring in varstrings 7, 8 & 9
  171. matchclr
  172. matchstr 1 21 "OK\13\10"
  173. write "ATD^3^7;\13"
  174. matchread 400
  175. jump 101
  176. @LABEL 21
  177. matchclr
  178. matchstr 1 22 "OK\13\10"
  179. write "ATD^3^8;\13"
  180. matchread 400
  181. jump 101
  182. @LABEL 22
  183. write "ATD^3^9\13"
  184. jump 32
  185. !
  186. !
  187. @LABEL 24
  188. !  Write dialstring in varstrings 7 & 8
  189. matchclr
  190. matchstr 1 25 "OK\13\10"
  191. write "ATD^3^7;\13"
  192. matchread 400
  193. jump 101
  194. @LABEL 25
  195. write "ATD^3^8\13"
  196. jump 32
  197. !
  198. @LABEL 27
  199. !  Write dialstring in varstring 7
  200. write "ATD^3^7\13"
  201. !
  202. !
  203. !    ---- Connection response ----
  204. !
  205. ! The following section will parse modem responses of five types:
  206. !   1) PROTOCOL: xxx, COMPRESSION: xxx, CONNECT xxx
  207. !   2) CONNECT xxx/ARQ/V42
  208. !   3) Standard incoming and outgoing call progress messages
  209. !   4) FAX/DATA discrimination messages
  210. !   5) International DELAYED & BLACKLISTED restrictions.
  211. !
  212. @LABEL 32
  213. matchclr
  214. matchstr  1 81  "RING\13\10"
  215. matchstr  2 102 "NO DIALTONE\13\10"
  216. matchstr  3 103 "NO CARRIER"
  217. matchstr  4 103 "ERROR\13\10"
  218. matchstr  5 104 "BUSY\13\10"
  219. matchstr  6 105 "NO ANSWER\13\10"
  220. matchstr  7 33  "CONNECT "
  221. matchstr  8 32  "CARRIER"
  222. matchstr  9 40  "CONNECT\13\10"
  223. matchstr 10 74  "PROTOCOL: LAP"
  224. matchstr 11 74  "PROTOCOL: MNP"
  225. matchstr 12 74  "PROTOCOL: ALT"
  226. matchstr 13 76  "COMPRESSION: V"
  227. matchstr 14 76  "COMPRESSION: MNP5"
  228. matchstr 15 76  "COMPRESSION: CLASS"
  229. matchstr 16 110  "DELAYED  "
  230. matchstr 17 111  "BLACKLISTED\13\10"
  231. matchread 700
  232. ifANSWER 32
  233. jump 101
  234. !
  235. @LABEL 33
  236. matchclr
  237. matchstr  1 39 "24000"
  238. matchstr  2 40 "26400"
  239. matchstr  3 41 "28800"
  240. matchstr  4 42 "29333"
  241. matchstr  5 43 "30667"
  242. matchstr  6 44 "31200"
  243. matchstr  7 45 "32000"
  244. matchstr  8 46 "33333"
  245. matchstr  9 47 "33600"
  246. matchstr 10 48 "34000"
  247. matchstr 11 49 "34667"
  248. matchstr 12 50 "36000"
  249. matchstr 13 51 "37333"
  250. matchstr 14 52 "38000"
  251. matchstr 15 53 "38667"
  252. matchstr 16 54 "40000"
  253. matchstr 17 55 "41333"
  254. matchstr 18 56 "42000"
  255. matchstr 19 57 "42667"
  256. matchstr 20 58 "44000"
  257. matchstr 21 59 "45333"
  258. matchstr 22 60 "46000"
  259. matchstr 23 61 "46667"
  260. matchstr 24 62 "48000"
  261. matchstr 25 63 "49333"
  262. matchstr 26 64 "50000"
  263. matchstr 27 65 "50667"
  264. matchstr 28 66 "52000"
  265. matchstr 29 67 "53333"
  266. matchstr 30 68 "54000"
  267. matchstr 31 69 "54667"
  268. matchstr 32 70 "56000"
  269. matchread 30
  270. jump 71
  271. !
  272. ! -- Connection rates --
  273. ! CommunicatingAt informs ARA of the raw modem to modem
  274. ! connection speed.
  275. !
  276. @LABEL 39
  277. note "Communicating at 24000 bps." 2
  278. CommunicatingAt 24000
  279. jump 72
  280. !
  281. @LABEL 40
  282. note "Communicating at 26400 bps." 2
  283. CommunicatingAt 26400
  284. jump 72
  285. !
  286. @LABEL 41
  287. note "Communicating at 28800 bps." 2
  288. CommunicatingAt 28800
  289. jump 72
  290. !
  291. @LABEL 42
  292. note "Communicating at 29333 bps." 2
  293. CommunicatingAt 29333
  294. jump 72
  295. !
  296. @LABEL 43
  297. note "Communicating at 30667 bps." 2
  298. CommunicatingAt 30667
  299. jump 72
  300. !
  301. @LABEL 44
  302. note "Communicating at 31200 bps." 2
  303. CommunicatingAt 31200
  304. jump 72
  305. !
  306. @LABEL 45
  307. note "Communicating at 32000 bps." 2
  308. CommunicatingAt 32000
  309. jump 72
  310. !
  311. @LABEL 46
  312. note "Communicating at 33333 bps." 2
  313. CommunicatingAt 33333
  314. jump 72
  315. !
  316. @LABEL 47
  317. note "Communicating at 33600 bps." 2
  318. CommunicatingAt 33600
  319. jump 72
  320. !
  321. @LABEL 48
  322. note "Communicating at 34000 bps." 2
  323. CommunicatingAt 34000
  324. jump 72
  325. !
  326. @LABEL 49
  327. note "Communicating at 34667 bps." 2
  328. CommunicatingAt 34667
  329. jump 72
  330. !
  331. @LABEL 50
  332. note "Communicating at 36000 bps." 2
  333. CommunicatingAt 36000
  334. jump 72
  335. !
  336. @LABEL 51
  337. note "Communicating at 37333 bps." 2
  338. CommunicatingAt 37333
  339. jump 72
  340. !
  341. @LABEL 52
  342. note "Communicating at 38000 bps." 2
  343. CommunicatingAt 38000
  344. jump 72
  345. !
  346. @LABEL 53
  347. note "Communicating at 38667 bps." 2
  348. CommunicatingAt 38667
  349. jump 72
  350. !
  351. @LABEL 54
  352. note "Communicating at 40000 bps." 2
  353. CommunicatingAt 40000
  354. jump 72
  355. !
  356. @LABEL 55
  357. note "Communicating at 41333 bps." 2
  358. CommunicatingAt 41333
  359. jump 72
  360. !
  361. @LABEL 56
  362. note "Communicating at 42000 bps." 2
  363. CommunicatingAt 42000
  364. jump 72
  365. !
  366. @LABEL 57
  367. note "Communicating at 42667 bps." 2
  368. CommunicatingAt 42667
  369. jump 72
  370. !
  371. @LABEL 58
  372. note "Communicating at 44000 bps." 2
  373. CommunicatingAt 44000
  374. jump 72
  375. !
  376. @LABEL 59
  377. note "Communicating at 45333 bps." 2
  378. CommunicatingAt 45333
  379. jump 72
  380. !
  381. @LABEL 60
  382. note "Communicating at 46000 bps." 2
  383. CommunicatingAt 46000
  384. jump 72
  385. !
  386. @LABEL 61
  387. note "Communicating at 46667 bps." 2
  388. CommunicatingAt 46667
  389. jump 72
  390. !
  391. @LABEL 62
  392. note "Communicating at 48000 bps." 2
  393. CommunicatingAt 48000
  394. jump 72
  395. !
  396. @LABEL 63
  397. note "Communicating at 49333 bps." 2
  398. CommunicatingAt 49333
  399. jump 72
  400. !
  401. @LABEL 64
  402. note "Communicating at 50000 bps." 2
  403. CommunicatingAt 50000
  404. jump 72
  405. !
  406. @LABEL 65
  407. note "Communicating at 50667 bps." 2
  408. CommunicatingAt 50667
  409. jump 72
  410. !
  411. @LABEL 66
  412. note "Communicating at 52000 bps." 2
  413. CommunicatingAt 52000
  414. jump 72
  415. !
  416. @LABEL 67
  417. note "Communicating at 53333 bps." 2
  418. CommunicatingAt 53333
  419. jump 72
  420. !
  421. @LABEL 68
  422. note "Communicating at 54000 bps." 2
  423. CommunicatingAt 54000
  424. jump 72
  425. !
  426. @LABEL 69
  427. note "Communicating at 54667 bps." 2
  428. CommunicatingAt 54667
  429. jump 72
  430. !
  431. @LABEL 70
  432. note "Communicating at 56000 bps." 2
  433. CommunicatingAt 56000
  434. jump 72
  435. !
  436. @LABEL 71
  437. note "Communicating at less than 24000 bps." 2
  438. jump 72
  439. !
  440. ! Look for reliablilty and compression results 
  441. ! at the end of the connect result.
  442. !
  443. @LABEL 72
  444. matchclr
  445. matchstr  1 75 "LAPM"
  446. matchstr  2 75 "REL"
  447. matchstr  3 75 "ARQ"
  448. matchstr  4 77 "COMP/"
  449. matchstr  5 77 "COMP\13"
  450. matchstr  6 75 "V42/"
  451. matchstr  7 75 "V42\13"
  452. matchstr  8 77 "V42BIS"
  453. matchstr  9 77 "V42bis"
  454. matchstr 10 75 "MNP\13"
  455. matchstr 11 77 "MNP5"
  456. matchstr 12 78 "\10"
  457. matchread 30
  458. jump 78
  459. ! -- Modem error correction link negotiation --
  460. ! Userhook 2 informs ARA that a modem-to-modem error
  461. ! correcting protocol has been negotiated
  462. !
  463. !
  464. @LABEL 74
  465. note "Modem Reliable Link Established." 2
  466. userhook 2
  467. jump 32
  468. !
  469. @LABEL 75
  470. note "Modem Reliable Link Established." 2
  471. userhook 2
  472. jump 72
  473. !
  474. ! -- Compression negotiation --
  475. ! Userhook 3 informs ARA that a modem-to-modem compression
  476. ! protocol has been negotiated
  477. !
  478. @LABEL 76
  479. note "Modem Compression Established." 2
  480. userhook 3
  481. jump 32
  482. !
  483. @LABEL 77
  484. note "Modem Compression Established." 2
  485. userhook 3
  486. jump 72
  487. !
  488. !
  489. ! -- Normal exit after "CONNECT" --
  490. !
  491. !  This modem has been setup to do CTS handshaking,
  492. !  and we assume that a CTS handshaking cable is being used.
  493. !
  494. @LABEL 78
  495. ! Turn on CTS handshaking.
  496. HSReset 0 1 0 0 0 0
  497. !
  498. ifANSWER 79
  499. pause 30
  500. @LABEL 79
  501. exit 0
  502. !
  503. !
  504. ! ---- Answer calls ----
  505. !
  506. ! A RING results from the modem in ANSWERING mode
  507. ! claims the serial port and answering the phone
  508. !
  509. @LABEL 81
  510. ifORIGINATE 32
  511. userhook 1
  512. note "Answering phone..." 2
  513. write "ATA\13"
  514. jump 32
  515. !  
  516. ! ---- Hang up and reset modem ----
  517. !
  518. @HANGUP 
  519. @LABEL 90 
  520. settries 0
  521. HSReset 0 0 0 0 0 0
  522. !
  523. @LABEL 91
  524. ! Try to get control of the modem
  525. !pause 1
  526. !write "+++"
  527. !pause 1 
  528. !matchclr
  529. !matchstr 1 96 "OK\13\10"
  530. !pause 15
  531. !write "AT\13"
  532. !matchread 30
  533. !
  534. @LABEL 94
  535. ! Force a hangup
  536. matchclr
  537. matchstr 1 98 "NO CARRIER\13\10"
  538. matchstr 2 98 "OK\13\10"
  539. matchstr 3 98 "ERROR\13\10"
  540. matchstr 4 98 "0\13\10"
  541. matchstr 5 98 "DELAYED"
  542. matchstr 6 98 "BLACKLISTED"
  543. write "+++ATH\13"
  544. matchread 30
  545. ! Try again to get control of the modem by toggling DTR
  546. !
  547. @LABEL 95
  548. DTRClear
  549. Pause 2
  550. DTRSet
  551. flush
  552. !
  553. !
  554. ! Try the hangup sequence three times otherwise declare an error
  555. inctries
  556. iftries 3 101
  557. jump 91
  558. !
  559. @LABEL 96
  560. !
  561. ! Pause between data and command mode
  562. !
  563. pause 50
  564. jump 94
  565. !
  566. !
  567. @LABEL 97
  568. ! AT&F1 resulted in Error, try again using AT&F
  569. pause 15
  570. matchclr
  571. matchstr 1 99 "OK\13\10"
  572. write "AT&FS0=0\13"
  573. matchread 30
  574. jump 101
  575. !
  576. @LABEL 98
  577. ! Got control of the modem.  Recall the factory settings.  If it fails, jump 97.
  578. pause 15
  579. matchclr
  580. matchstr 1 99 "OK\13\10"
  581. matchstr 2 97 "ERROR\13\10"
  582. write "AT&F1S0=0\13"
  583. matchread 30
  584. jump 101
  585. !
  586. @LABEL 99
  587. exit 0
  588. !
  589. ! ---- Error messages -----
  590. !
  591. ! Modem Not Responding
  592. @LABEL 101
  593. exit -6019
  594. !
  595. ! No Dial Tone
  596. @LABEL 102
  597. exit -6020
  598. !
  599. ! No Carrier or Error
  600. @LABEL 103
  601. exit -6021
  602. !
  603. ! Busy
  604. @LABEL 104
  605. exit -6022
  606. !
  607. ! No Answer
  608. @LABEL 105
  609. exit -6023
  610. !
  611. ! User Cancellation
  612. @LABEL 107
  613. exit -6008
  614. !
  615. ! ---- DELAYED and BLACKLISTED functions ----
  616. @LABEL 110
  617. matchclr
  618. matchstr  1 119 "00:00:0"
  619. matchstr  2 118 "00:00:1"
  620. matchstr  3 117 "00:00:2"
  621. matchstr  4 116 "00:00:3"
  622. matchstr  5 115 "00:00:4"
  623. matchstr  6 114 "00:00:5"
  624. matchstr  7 113 "00:01:"
  625. matchstr  8 112 "00:02:"
  626. matchread 30
  627. !  The number is 'DELAYED' more than 3 minutes.  Exit the script telling the user to wait or reset his modem.
  628. !
  629. exit -6019 "\13The modem responds 'DELAYED':\13(Cannot redial this number right now.)\13To try again immediately, turn modem OFF and ON before proceeding."
  630. @LABEL 111
  631. !  The number is 'BLACKLISTED'.  Exit the script, telling the user to reset his modem.
  632. exit -6019 "\13The modem responds 'BLACKLISTED':\13(Cannot redial this number again.)\13Double-check the number, then turn your modem OFF and ON before proceeding."
  633. !
  634. @LABEL 112
  635. note "'DELAYED'. Redialing in 3 minutes..."
  636. pause 600
  637. @LABEL 113
  638. note "'DELAYED'. Redialing in 2 minutes..."
  639. pause 600
  640. @LABEL 114
  641. note "'DELAYED'. Redialing in 1 minute... "
  642. pause 100
  643. @LABEL 115
  644. note "'DELAYED'. Redialing in 50 seconds..."
  645. pause 100
  646. @LABEL 116
  647. note "'DELAYED'. Redialing in 40 seconds..."
  648. pause 100
  649. @LABEL 117
  650. note "'DELAYED'. Redialing in 30 seconds..."
  651. pause 100
  652. @LABEL 118
  653. note "'DELAYED'. Redialing in 20 seconds..."
  654. pause 100
  655. @LABEL 119
  656. note "'DELAYED'. Redialing in 10 seconds..."
  657. pause 100
  658. jump 1
  659. ! Labels 121-128 are reserved for emergency hacks.
  660. !
  661.